/**
 * Created by Xiaoming on 2017/3/13.
 */
angular.module('service.order', [
        "ngResource",
    ])
    //认证服务
    .service('OrderService', ['$resource',function($resource){
        //根据用户id获取订单
        this.getOrderByCid =function(cid){
            var resource = $resource(marketurl+ 'order/bycid/:cid');
            return  resource.query({cid:cid});
        };
        //根据超市id获取超市
        this.getMarketByMarketid  =function(marketid ){
            var resource = $resource(marketurl+ 'market/:marketid');
            return  resource.get({marketid :marketid});
        };
        //新增订单
        this.updateNewOrder =function(order,success,error){
            var resource = $resource(marketurl+ 'order');
            return  resource.save(order,success,error);
        };
        //根据订单id获取订单
        this.getOrderByOrderId =function(orderid){
            var resource = $resource(marketurl+ 'order/:orderid');
            return  resource.get({orderid:orderid});
        };
    }])